export const crudOptions = vm => {
  return {
    indexRow: {
      title: '序号',
      align: 'center'
    },
    options: {
      height: '100%'
    },
    columns: [
      {
        title: '姓名',
        key: 'name',
        align: 'center',
        search: {
          disabled: false
        },
        form: {
          rules: [
            { required: true, trigger: 'blur', message: '请输入姓名' },
            { min: 1, max: 10, trigger: 'blur', message: '姓名长度在1-10个字符之间' }
          ]
        },
        valueBuilder (row, key) {
          console.log('BuilderRow', row)
          console.log('BuilderKey', key)
        },
        valueResolve (row, key) {
          console.log('ResolveRow', row)
          console.log('ResolveKey', key)
        }
      },
      {
        title: '身份证号码',
        key: 'IDNo',
        align: 'center',
        search: {
          disabled: false
        },
        form: {
          rules: [
            { required: true, trigger: 'blur', message: '请输入身份证号码' },
            { pattern: /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/, trigger: 'blur', message: '请输入正确的身份证号码' }
          ]
        }
      },
      {
        title: '地址',
        key: 'address',
        align: 'center',
        form: {
          rules: [
            { required: true, trigger: 'blur', message: '请输入居住地址' },
            { max: 50, trigger: 'blur', message: '地址长度不可以大于50个字符' }
          ]
        }
      },
      {
        title: '电话',
        key: 'phone',
        align: 'center',
        form: {
          rules: [
            { required: true, trigger: 'blur', message: '请输入电话' },
            { pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, trigger: 'blur', message: '请输入正确的手机号码' }
          ]
        }
      },
      {
        title: '血型',
        key: 'bloodType',
        align: 'center',
        dict: {
          isTree: false,
          data: [
            {
              value: 'A',
              label: 'A'
            },
            {
              value: 'B',
              label: 'B'
            },
            {
              value: 'AB',
              label: 'AB'
            },
            {
              value: 'O',
              label: 'O'
            }
          ]
        },
        search: {
          disabled: true,
          component: 'dict-select'
        },
        form: {
          rules: [
            { required: true, trigger: 'blur', message: '请输入血型' }
          ],
          component: {
            name: 'dict-select',
            props: {
              filterable: true,
              multiple: false,
              clearable: true
            }
          }
        }
      },
      {
        title: '备注',
        key: 'remark',
        align: 'center'
      }
    ],
    rowHandle: {
      align: 'center',
      view: false,
      custom: [
        {
          thin: false,
          text: '查看',
          icon: 'el-view',
          size: 'small',
          show: true,
          disabled: false,
          order: 1,
          emit: 'view'
        }
      ]
    }
  }
}
